package com.study.testSpringBoot.webThree;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

import org.springframework.context.ApplicationContext;
import org.springframework.web.context.support.WebApplicationContextUtils;

/**
 * 监听器
 */
@WebListener
public class MyListener implements ServletContextListener {

	
	@Override
	public void contextInitialized(ServletContextEvent sce) {
		System.out.println("监听器的初始化方法。。。");
		ServletContext servletContext = sce.getServletContext();
//		ApplicationContext ctx = WebApplicationContextUtils.getWebApplicationContext(servletContext);
//		ctx.getBean("");
	}
	
	@Override
	public void contextDestroyed(ServletContextEvent sce) {
		System.out.println("监听器的销毁方法。。。");
	}
}
